Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

feature/settings/src/androidTest/kotlin/org/meshtastic/feature/settings/radio/component/EditDeviceProfileDialogTest.kt 1c3784235e7e20ed88e054097d2e7addbff92dc3 (1c378423) Text, 3.88 KB

T8b949e/*
* Copyright (c) 2025 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

Tff7b72package T7ee787org.meshtastic.feature.settings.radio.component

Tff7b72import T7ee787androidx.compose.ui.test.assertIsDisplayed
Tff7b72import T7ee787androidx.compose.ui.test.junit4.createComposeRule
Tff7b72import T7ee787androidx.compose.ui.test.onNodeWithText
Tff7b72import T7ee787androidx.compose.ui.test.performClick
Tff7b72import T7ee787androidx.test.ext.junit.runners.AndroidJUnit4
Tff7b72import T7ee787androidx.test.platform.app.InstrumentationRegistry
Tff7b72import T7ee787org.junit.Assert
Tff7b72import T7ee787org.junit.Rule
Tff7b72import T7ee787org.junit.Test
Tff7b72import T7ee787org.junit.runner.RunWith
Tff7b72import T7ee787org.meshtastic.proto.ClientOnlyProtos.DeviceProfile
Tff7b72import T7ee787org.meshtastic.proto.deviceProfile
Tff7b72import T7ee787org.meshtastic.proto.position
Tff7b72import T7ee787org.meshtastic.core.strings.R Tff7b72as Te6edf3Res

Tf0883e@RunWithTb4b4b4(Te6edf3AndroidJUnit4Tff7b72::Te6edf3classTb4b4b4)
Tff7b72class T56d364EditDeviceProfileDialogTest Tb4b4b4{

Tf0883e@getTb4b4b4:Te6edf3Rule Tff7b72val Te6edf3composeTestRule Tff7b72= Te6edf3createComposeRuleTb4b4b4(Tb4b4b4)

Tff7b72private Tff7b72fun Td2a8ffgetStringTb4b4b4(Te6edf3idTb4b4b4: Tffa657IntTb4b4b4)Tb4b4b4: Tffa657String Tff7b72= Te6edf3InstrumentationRegistryTb4b4b4.Te6edf3getInstrumentationTb4b4b4(Tb4b4b4)Tb4b4b4.Te6edf3targetContextTb4b4b4.Te6edf3getStringTb4b4b4(Te6edf3idTb4b4b4)

Tff7b72private Tff7b72val Te6edf3title Tff7b72= Ta5d6ff"Ta5d6ffExport configurationTa5d6ff"
Tff7b72private Tff7b72val Te6edf3deviceProfile Tff7b72= Te6edf3deviceProfile Tb4b4b4{
Te6edf3longName Tff7b72= Ta5d6ff"Ta5d6ffLong nameTa5d6ff"
Te6edf3shortName Tff7b72= Ta5d6ff"Ta5d6ffShort nameTa5d6ff"
Te6edf3channelUrl Tff7b72= Ta5d6ff"Ta5d6ffhttps://meshtastic.org/e/#CgMSAQESBggBQANIAQTa5d6ff"
Te6edf3fixedPosition Tff7b72= Te6edf3position Tb4b4b4{
Te6edf3latitudeI Tff7b72= T79c0ff3T79c0ff2T79c0ff7T79c0ff7T79c0ff6T79c0ff6T79c0ff6T79c0ff5T79c0ff0
Te6edf3longitudeI Tff7b72= Tff7b72-T79c0ff9T79c0ff6T79c0ff7T79c0ff9T79c0ff6T79c0ff9T79c0ff8T79c0ff9T79c0ff0
Te6edf3altitude Tff7b72= T79c0ff1T79c0ff3T79c0ff8
Tb4b4b4}
Tb4b4b4}

Tff7b72private Tff7b72fun Td2a8fftestEditDeviceProfileDialogTb4b4b4(Te6edf3onDismissTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657Unit Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4, Te6edf3onConfirmTb4b4b4: Tb4b4b4(Te6edf3DeviceProfileTb4b4b4) Tff7b72-Tff7b72> Tffa657Unit Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4) Tff7b72=
Te6edf3composeTestRuleTb4b4b4.Te6edf3setContent Tb4b4b4{
Te6edf3EditDeviceProfileDialogTb4b4b4(
Te6edf3title Tff7b72= Te6edf3titleTb4b4b4,
Te6edf3deviceProfile Tff7b72= Te6edf3deviceProfileTb4b4b4,
Te6edf3onConfirm Tff7b72= Te6edf3onConfirmTb4b4b4,
Te6edf3onDismiss Tff7b72= Te6edf3onDismissTb4b4b4,
Tb4b4b4)
Tb4b4b4}

Tf0883e@Test
Tff7b72fun Td2a8fftestEditDeviceProfileDialog_showsDialogTitleTb4b4b4(Tb4b4b4) Tb4b4b4{
Te6edf3composeTestRuleTb4b4b4.Te6edf3apply Tb4b4b4{
Te6edf3testEditDeviceProfileDialogTb4b4b4(Tb4b4b4)

T8b949e// Verify that the dialog title is displayed
Te6edf3onNodeWithTextTb4b4b4(Te6edf3titleTb4b4b4)Tb4b4b4.Te6edf3assertIsDisplayedTb4b4b4(Tb4b4b4)
Tb4b4b4}
Tb4b4b4}

Tf0883e@Test
Tff7b72fun Td2a8fftestEditDeviceProfileDialog_showsCancelAndSaveButtonsTb4b4b4(Tb4b4b4) Tb4b4b4{
Te6edf3composeTestRuleTb4b4b4.Te6edf3apply Tb4b4b4{
Te6edf3testEditDeviceProfileDialogTb4b4b4(Tb4b4b4)

T8b949e// Verify the "Cancel" and "Save" buttons are displayed
Te6edf3onNodeWithTextTb4b4b4(Te6edf3getStringTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3cancelTb4b4b4)Tb4b4b4)Tb4b4b4.Te6edf3assertIsDisplayedTb4b4b4(Tb4b4b4)
Te6edf3onNodeWithTextTb4b4b4(Te6edf3getStringTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3saveTb4b4b4)Tb4b4b4)Tb4b4b4.Te6edf3assertIsDisplayedTb4b4b4(Tb4b4b4)
Tb4b4b4}
Tb4b4b4}

Tf0883e@Test
Tff7b72fun Td2a8fftestEditDeviceProfileDialog_clickCancelButtonTb4b4b4(Tb4b4b4) Tb4b4b4{
Tff7b72var Te6edf3onDismissClicked Tff7b72= Tff7b72false
Te6edf3composeTestRuleTb4b4b4.Te6edf3apply Tb4b4b4{
Te6edf3testEditDeviceProfileDialogTb4b4b4(Te6edf3onDismiss Tff7b72= Tb4b4b4{ Te6edf3onDismissClicked Tff7b72= Tff7b72true Tb4b4b4}Tb4b4b4)

T8b949e// Click the "Cancel" button
Te6edf3onNodeWithTextTb4b4b4(Te6edf3getStringTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3cancelTb4b4b4)Tb4b4b4)Tb4b4b4.Te6edf3performClickTb4b4b4(Tb4b4b4)
Tb4b4b4}

T8b949e// Verify onDismiss is called
Te6edf3AssertTb4b4b4.Te6edf3assertTrueTb4b4b4(Te6edf3onDismissClickedTb4b4b4)
Tb4b4b4}

Tf0883e@Test
Tff7b72fun Td2a8fftestEditDeviceProfileDialog_addChannelsTb4b4b4(Tb4b4b4) Tb4b4b4{
Tff7b72var Te6edf3actualDeviceProfileTb4b4b4: Te6edf3DeviceProfile? Tff7b72= Tff7b72null
Te6edf3composeTestRuleTb4b4b4.Te6edf3apply Tb4b4b4{
Te6edf3testEditDeviceProfileDialogTb4b4b4(Te6edf3onConfirm Tff7b72= Tb4b4b4{ Te6edf3actualDeviceProfile Tff7b72= Tffa657it Tb4b4b4}Tb4b4b4)

Te6edf3onNodeWithTextTb4b4b4(Te6edf3getStringTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3saveTb4b4b4)Tb4b4b4)Tb4b4b4.Te6edf3performClickTb4b4b4(Tb4b4b4)
Tb4b4b4}

T8b949e// Verify onConfirm is called with the correct DeviceProfile
Te6edf3AssertTb4b4b4.Te6edf3assertEqualsTb4b4b4(Te6edf3deviceProfileTb4b4b4, Te6edf3actualDeviceProfileTb4b4b4)
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.2 - Generated in 0.21s